package com.zj.dao.impl;

import com.zj.dao.UserDao;
import com.zj.pojo.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Repository("userDao")
//@Scope("prototype")  非单例
public class UserDaoImpl implements UserDao {
    @Value("${name}") //简单类型注入
    private String psw;
    public User selectById() {
        return new User("小狗蛋",psw);
    }
    @PostConstruct
    public void init(){
        System.out.println("init...");
    }
    @PreDestroy
    public  void destroy(){
        System.out.println("destroy...");
    }
}
